package light.head.model.inv;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
/**
 * 调拨信息
 * @author yy
 *
 */
@Entity
@Table
public class InvAllocate implements Serializable{
	
	private static final long serialVersionUID = 7251332665920127902L;
	
	private Integer code;
	private String dn;				// 出库单据编号（唯一性，按一定的规则生成 ck20140604）
	private Integer cu;				// 创建人
	private Integer oc;				// 机构编号
	private Date ct;				// 创建时间
	private Boolean deleted = false;// 是否删除
	private String remark;			// 备注
	private Boolean verify = false;	// 是否确认
	private Integer cvc;			// 确认人编号
	private Integer idc;			// 入库仓库编号
	private Integer odc;			// 出库仓库编号
	private Integer ioc;			// 入库仓机构
	private Date cvt;				// 确认时间
	
	private String cname;			// 确认人名称
	private String cn;
	private String on;
	private String ion;				// 入库仓机构名称
	private String idn;				// 入库仓库名称
	private String odn;				// 出库仓库名称
	private List<InvAllocateItem> itemList;
	
	
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column(length = 50)
	public String getDn() {
		return dn;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(nullable = false, updatable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column(length = 200)
	public String getRemark() {
		return remark;
	}
	@Column
	public Integer getIdc() {
		return idc;
	}
	@Column
	public Integer getOdc() {
		return odc;
	}
	@Column
	public Boolean getVerify() {
		return verify;
	}
	@Column
	public Integer getCvc() {
		return cvc;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	public Date getCvt() {
		return cvt;
	}
	@Column
	public Integer getIoc() {
		return ioc;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = ioc)")
	public String getIon() {
		return ion;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cvc)")
	public String getCname() {
		return cname;
	}
	@Formula("(SELECT d.name FROM InvDepot d WHERE d.code = idc)")
	public String getIdn() {
		return idn;
	}
	@Formula("(SELECT d.name FROM InvDepot d WHERE d.code = odc)")
	public String getOdn() {
		return odn;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCn() {
		return cn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	@Transient
	public List<InvAllocateItem> getItemList() {
		return itemList;
	}
	
	
	
	

	

	public void setIoc(Integer ioc) {
		this.ioc = ioc;
	}
	public void setIon(String ion) {
		this.ion = ion;
	}
	public void setCvt(Date cvt) {
		this.cvt = cvt;
	}
	public void setCvc(Integer cvc) {
		this.cvc = cvc;
	}
	public void setCname(String cname) {
		this.cname = cname;
	}
	public void setVerify(Boolean verify) {
		this.verify = verify;
	}
	public void setIdn(String idn) {
		this.idn = idn;
	}
	public void setOdn(String odn) {
		this.odn = odn;
	}
	public void setIdc(Integer idc) {
		this.idc = idc;
	}
	public void setOdc(Integer odc) {
		this.odc = odc;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}

	public void setOn(String on) {
		this.on = on;
	}
	
	public void setItemList(List<InvAllocateItem> itemList) {
		this.itemList = itemList;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setDn(String dn) {
		this.dn = dn;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}

}
